From 90d76301b249240db792d17f38f2deb0e280a237 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Tue, 4 Aug 2026 18:13:35 +0000 Subject: [PATCH] Add example query showing sighting sources --- doc/src/analyzed/sightings.m4 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/src/analyzed/sightings.m4 b/doc/src/analyzed/sightings.m4 index 6f0ea6f..2a8ea0c 100644 --- a/doc/src/analyzed/sightings.m4 +++ b/doc/src/analyzed/sightings.m4 @@ -72,6 +72,25 @@ retained -- recording the individual as "sighted". .. _sightings_source_determination: +The |SIGHTINGS.Step| column, in conjunction with the +|SIGHTING_CONTROLS| table, contains detail on the source of the +sighting. +But an individual may be sighted more than once per day. +When there is more than one sighting per day, the |SIGHTING_CONTROLS| +table contains detail on the "highest priority" data source, the table +or other place where the "most important" sighting was recorded. + +The following query reports sightings and their sources\ [#f1]_: + +.. code-block:: sql + :caption: Chimpanzee sightings, with detail on sighting data source + + SELECT sightings.*, sighting_controls.* + FROM sightings + JOIN sighting_controls + ON (sighting_controls.step = sightings.step) + ORDER BY sightings.animid, sightings.date; + .. contents:: :depth: 2 @@ -139,3 +158,11 @@ See :ref:`above ` for more information on how the value of this column is determined. |notnull| + + +.. rubric:: Footnotes + +.. [#f1] + The query uses the shorthand ``tablename.*`` to display all a + table's columns. + It may be more useful to list only those columns of interest. -- 2.34.1